package com.flux.controller;

import com.flux.domain.User;
import com.flux.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * Created by acer on 2018/4/8.
 */
@RestController
public class BasicController {
    @Autowired
    private UserService userService;

    @GetMapping(value = "/sayHello")
    public Mono sayHello(@RequestParam String name) {
        return Mono.just("Hello " + name + "'s world");
    }

    @GetMapping("/{id}")
    public Mono<User> getById(@PathVariable Integer id) {
        return userService.getById(id);
    }
}
